package com.deyuanyun.pic.ctrl.controller.vo.exinsp;

import com.deyuanyun.pic.common.spring.SpringAppliction;
import com.deyuanyun.pic.common.util.NumberUtil;
import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.ctrl.domain.EqptCptestStation;
import com.deyuanyun.pic.ctrl.domain.ExinspOclpointDig;
import com.deyuanyun.pic.ctrl.enumeration.DeeprootedPlantsEnum;
import com.deyuanyun.pic.ctrl.enumeration.GroundWaterEnum;
import com.deyuanyun.pic.ctrl.enumeration.SoilCompactnessEnum;
import com.deyuanyun.pic.ctrl.enumeration.SoilHumidityEnum;
import com.deyuanyun.pic.ctrl.service.EQPTBaseService;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.math.BigDecimal;

/**
 * T_4_7外涂层漏损点开挖检测记录表
 */
public class ExinspOclpointDigVO extends ExinspBaseVO<ExinspOclpointDig> {

    // 管道编号
    private String pipeLineName;
    // 防腐层漏损点编号PIC_CTRL_EXINSP_OCLPOINT.ID_
    private String oclpointNum;
    // 绝对距离（m）
    private BigDecimal mileage;
    // 附近测试桩
    private String nagm;
    // 附近测试桩距离（m）
    private BigDecimal nagmMileage;
    // 位置描述
    private String locationDesc;
    // 地形地貌描述
    private String terrainGeomorphoDesc;
    // 地下水（YES、NOTHING、UNSTABLE）
    private String groundWater;
    // 土壤电阻率（Ω·m）
    private BigDecimal soilResistivity;
    // 漏损点测量信息_长度（mm）
    public Long oclpointLength;
    // 漏损点测量信息_宽度（mm）
    public Long oclpointWidth;
    // 漏损点测量信息_时钟位置（h:min)
    private String oclpointClock;
    // 漏损点测量信息_描述
    private String oclpointDescription;
    // 阴保调查信息_自然电位
    private BigDecimal freeCorrPotential;
    // 阴保调查信息_通电电位
    private BigDecimal tubeGroundPotential;
    // 阴保调查信息_极化电位
    private BigDecimal polarizedPotential;
    // 阴保调查信息_交流电压
    private BigDecimal acPotential;
    // 外观描述
    private String appearance;
    // 涂层厚度（mm）_0:00
    private BigDecimal test1;
    // 涂层厚度（mm）_3:00
    private BigDecimal test2;
    // 涂层厚度（mm）_6:00
    private BigDecimal test3;
    // 涂层厚度（mm）_9:00
    private BigDecimal test4;
    // 剥离强度（N/cm)_1#
    public Long peelTest1;
    // 剥离强度（N/cm)_2#
    public Long peelTest2;
    // 剥离强度（N/cm)_3#
    public Long peelTest3;
    // 剥离强度（N/cm)_4#
    public Long peelTest4;
    // 电火花检漏_检漏电压（KV）
    public Long testVoltage;
    // 电火花检漏_漏点数
    public Long amount;
    // 土壤剖面描述_土壤颜色
    private String soilColor;
    // 土壤剖面描述_土壤干湿度（DRY、MOIST、DAMP、WET、WATER）
    private String soilHumidity;
    // 土壤剖面描述_土壤松紧度(LOOSE、PINE、A_LITTLE_TIGHT、TIGHT、VERY_TIGHT)
    private String soilCompactness;
    // 土壤剖面描述_根系植物（LUSH、SECONDARY、NOTHING、VERY_SELDOM ）
    private String deeprootedPlants;
    // 土壤理化性能_pH值
    public Long soilPh;
    // 土壤理化性能_氧化还原电位（mV）
    public Long redoxPotential;
    // 土壤理化性能_含水率（%）
    private BigDecimal moistureContent;
    // 土壤理化性能_含盐量（%）
    private BigDecimal saltContent;
    // 土壤理化性能_氯离子（%）
    private BigDecimal chlorideion;
    // 土壤理化性能_硫酸根离子（%）
    private BigDecimal sulfateion;

    // 管/地电位（mV）
    public Long pipeToSoilPotential;
    // 附着力/撬剥法（级）
    public Long adhesion;
    // 粘结强度/拉开法（MPa）
    private String bondstrength;
    // 剥离强度（N/cm）_对钢
    private String forsteel;
    // 剥离强度（N/cm）_对管体防腐层
    public Long pipeAnticorrLayer;
    // 管体壁厚（mm）
    private BigDecimal wallThickness;
    // 最大腐蚀坑深度（mm）
    private BigDecimal maxCorrDepth;
    // 最小剩余壁厚（mm）
    private BigDecimal minResidualWallThick;
    // 腐蚀缺陷最大轴向长度（mm）
    private BigDecimal maxAxialCorrDefects;
    // 腐蚀缺陷最大周向长度（mm）
    private BigDecimal maxCircCorrDefects;
    // 管体修复建议
    private String pipeBodyRepair;
    // 检测日期
    private String testingDate;
    // 检测单位
    private String testingCompany;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getOclpointNum() {
        return oclpointNum;
    }

    public void setOclpointNum(String oclpointNum) {
        this.oclpointNum = oclpointNum;
    }

    public BigDecimal getMileage() {
        return mileage;
    }

    public void setMileage(BigDecimal mileage) {
        this.mileage = mileage;
    }

    public String getNagm() {
        return nagm;
    }

    public void setNagm(String nagm) {
        this.nagm = nagm;
    }

    public BigDecimal getNagmMileage() {
        return nagmMileage;
    }

    public void setNagmMileage(BigDecimal nagmMileage) {
        this.nagmMileage = nagmMileage;
    }

    public String getLocationDesc() {
        return locationDesc;
    }

    public void setLocationDesc(String locationDesc) {
        this.locationDesc = locationDesc;
    }

    public String getTerrainGeomorphoDesc() {
        return terrainGeomorphoDesc;
    }

    public void setTerrainGeomorphoDesc(String terrainGeomorphoDesc) {
        this.terrainGeomorphoDesc = terrainGeomorphoDesc;
    }

    public String getGroundWater() {
        return groundWater;
    }

    public void setGroundWater(String groundWater) {
        this.groundWater = groundWater;
    }

    public BigDecimal getSoilResistivity() {
        return soilResistivity;
    }

    public void setSoilResistivity(BigDecimal soilResistivity) {
        this.soilResistivity = soilResistivity;
    }

    public Long getOclpointLength() {
        return oclpointLength;
    }

    public void setOclpointLength(Long oclpointLength) {
        this.oclpointLength = oclpointLength;
    }

    public Long getOclpointWidth() {
        return oclpointWidth;
    }

    public void setOclpointWidth(Long oclpointWidth) {
        this.oclpointWidth = oclpointWidth;
    }

    public String getOclpointClock() {
        return oclpointClock;
    }

    public void setOclpointClock(String oclpointClock) {
        this.oclpointClock = oclpointClock;
    }

    public String getOclpointDescription() {
        return oclpointDescription;
    }

    public void setOclpointDescription(String oclpointDescription) {
        this.oclpointDescription = oclpointDescription;
    }

    public BigDecimal getFreeCorrPotential() {
        return freeCorrPotential;
    }

    public void setFreeCorrPotential(BigDecimal freeCorrPotential) {
        this.freeCorrPotential = freeCorrPotential;
    }

    public BigDecimal getTubeGroundPotential() {
        return tubeGroundPotential;
    }

    public void setTubeGroundPotential(BigDecimal tubeGroundPotential) {
        this.tubeGroundPotential = tubeGroundPotential;
    }

    public BigDecimal getPolarizedPotential() {
        return polarizedPotential;
    }

    public void setPolarizedPotential(BigDecimal polarizedPotential) {
        this.polarizedPotential = polarizedPotential;
    }

    public BigDecimal getAcPotential() {
        return acPotential;
    }

    public void setAcPotential(BigDecimal acPotential) {
        this.acPotential = acPotential;
    }

    public String getAppearance() {
        return appearance;
    }

    public void setAppearance(String appearance) {
        this.appearance = appearance;
    }

    public BigDecimal getTest1() {
        return test1;
    }

    public void setTest1(BigDecimal test1) {
        this.test1 = test1;
    }

    public BigDecimal getTest2() {
        return test2;
    }

    public void setTest2(BigDecimal test2) {
        this.test2 = test2;
    }

    public BigDecimal getTest3() {
        return test3;
    }

    public void setTest3(BigDecimal test3) {
        this.test3 = test3;
    }

    public BigDecimal getTest4() {
        return test4;
    }

    public void setTest4(BigDecimal test4) {
        this.test4 = test4;
    }

    public Long getPeelTest1() {
        return peelTest1;
    }

    public void setPeelTest1(Long peelTest1) {
        this.peelTest1 = peelTest1;
    }

    public Long getPeelTest2() {
        return peelTest2;
    }

    public void setPeelTest2(Long peelTest2) {
        this.peelTest2 = peelTest2;
    }

    public Long getPeelTest3() {
        return peelTest3;
    }

    public void setPeelTest3(Long peelTest3) {
        this.peelTest3 = peelTest3;
    }

    public Long getPeelTest4() {
        return peelTest4;
    }

    public void setPeelTest4(Long peelTest4) {
        this.peelTest4 = peelTest4;
    }

    public Long getTestVoltage() {
        return testVoltage;
    }

    public void setTestVoltage(Long testVoltage) {
        this.testVoltage = testVoltage;
    }

    public Long getAmount() {
        return amount;
    }

    public void setAmount(Long amount) {
        this.amount = amount;
    }

    public String getSoilColor() {
        return soilColor;
    }

    public void setSoilColor(String soilColor) {
        this.soilColor = soilColor;
    }

    public String getSoilHumidity() {
        return soilHumidity;
    }

    public void setSoilHumidity(String soilHumidity) {
        this.soilHumidity = soilHumidity;
    }

    public String getSoilCompactness() {
        return soilCompactness;
    }

    public void setSoilCompactness(String soilCompactness) {
        this.soilCompactness = soilCompactness;
    }

    public String getDeeprootedPlants() {
        return deeprootedPlants;
    }

    public void setDeeprootedPlants(String deeprootedPlants) {
        this.deeprootedPlants = deeprootedPlants;
    }

    public Long getSoilPh() {
        return soilPh;
    }

    public void setSoilPh(Long soilPh) {
        this.soilPh = soilPh;
    }

    public Long getRedoxPotential() {
        return redoxPotential;
    }

    public void setRedoxPotential(Long redoxPotential) {
        this.redoxPotential = redoxPotential;
    }

    public BigDecimal getMoistureContent() {
        return moistureContent;
    }

    public void setMoistureContent(BigDecimal moistureContent) {
        this.moistureContent = moistureContent;
    }

    public BigDecimal getSaltContent() {
        return saltContent;
    }

    public void setSaltContent(BigDecimal saltContent) {
        this.saltContent = saltContent;
    }

    public BigDecimal getChlorideion() {
        return chlorideion;
    }

    public void setChlorideion(BigDecimal chlorideion) {
        this.chlorideion = chlorideion;
    }

    public BigDecimal getSulfateion() {
        return sulfateion;
    }

    public void setSulfateion(BigDecimal sulfateion) {
        this.sulfateion = sulfateion;
    }

    public Long getPipeToSoilPotential() {
        return pipeToSoilPotential;
    }

    public void setPipeToSoilPotential(Long pipeToSoilPotential) {
        this.pipeToSoilPotential = pipeToSoilPotential;
    }

    public Long getAdhesion() {
        return adhesion;
    }

    public void setAdhesion(Long adhesion) {
        this.adhesion = adhesion;
    }

    public String getBondstrength() {
        return bondstrength;
    }

    public void setBondstrength(String bondstrength) {
        this.bondstrength = bondstrength;
    }

    public String getForsteel() {
        return forsteel;
    }

    public void setForsteel(String forsteel) {
        this.forsteel = forsteel;
    }

    public Long getPipeAnticorrLayer() {
        return pipeAnticorrLayer;
    }

    public void setPipeAnticorrLayer(Long pipeAnticorrLayer) {
        this.pipeAnticorrLayer = pipeAnticorrLayer;
    }

    public BigDecimal getWallThickness() {
        return wallThickness;
    }

    public void setWallThickness(BigDecimal wallThickness) {
        this.wallThickness = wallThickness;
    }

    public BigDecimal getMaxCorrDepth() {
        return maxCorrDepth;
    }

    public void setMaxCorrDepth(BigDecimal maxCorrDepth) {
        this.maxCorrDepth = maxCorrDepth;
    }

    public BigDecimal getMinResidualWallThick() {
        return minResidualWallThick;
    }

    public void setMinResidualWallThick(BigDecimal minResidualWallThick) {
        this.minResidualWallThick = minResidualWallThick;
    }

    public BigDecimal getMaxAxialCorrDefects() {
        return maxAxialCorrDefects;
    }

    public void setMaxAxialCorrDefects(BigDecimal maxAxialCorrDefects) {
        this.maxAxialCorrDefects = maxAxialCorrDefects;
    }

    public BigDecimal getMaxCircCorrDefects() {
        return maxCircCorrDefects;
    }

    public void setMaxCircCorrDefects(BigDecimal maxCircCorrDefects) {
        this.maxCircCorrDefects = maxCircCorrDefects;
    }

    public String getPipeBodyRepair() {
        return pipeBodyRepair;
    }

    public void setPipeBodyRepair(String pipeBodyRepair) {
        this.pipeBodyRepair = pipeBodyRepair;
    }

    //    public EQPTBaseService getEqptBaseService() {
//        return eqptBaseService;
////    }

    public void setEqptBaseService(EQPTBaseService eqptBaseService) {
        this.eqptBaseService = eqptBaseService;
    }

    public String getTestingDate() {
        return testingDate;
    }

    public void setTestingDate(String testingDate) {
        this.testingDate = testingDate;
    }

    public String getTestingCompany() {
        return testingCompany;
    }

    public void setTestingCompany(String testingCompany) {
        this.testingCompany = testingCompany;
    }

    EQPTBaseService eqptBaseService = SpringAppliction.getBean(EQPTBaseService.class);

    public void fromDomain(ExinspOclpointDig domain) {

        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 漏损点编号
        this.oclpointNum = domain.getOclpointId();
        // 绝对距离（m）
        this.mileage = NumberUtil.toMeter(domain.getMileage());
        // 附近测试桩
        if(domain.getNagm() != null) {
            EqptCptestStation eqptCptestStation = eqptBaseService.queryObjectByPrimaryKey(EqptCptestStation.class, domain.getNagm());
            this.nagm = eqptCptestStation == null ? null : eqptCptestStation.getCustomNumber();
        }
        // 附近测试桩距离（m）
        this.nagmMileage = NumberUtil.toMeter(domain.getNagmMileage());
        // 位置描述
        this.locationDesc = domain.getLocationDesc();
        // 地形地貌描述
        this.terrainGeomorphoDesc = domain.getTerrainGeomorphoDesc();
        // 地下水（YES、NOTHING、UNSTABLE）
        this.groundWater = GroundWaterEnum.getLabel(domain.getGroundWater());
        // 土壤电阻率（Ω·m）
        this.soilResistivity = domain.getSoilResistivity();
        // 漏损点测量信息_长度（mm）
        this.oclpointLength = domain.getOclpointLength();
        // 漏损点测量信息_宽度（mm）
        this.oclpointWidth = domain.getOclpointWidth();
        // 漏损点测量信息_时钟位置（h:min)
        this.oclpointClock = domain.getOclpointClock();
        // 漏损点测量信息_描述
        this.oclpointDescription = domain.getOclpointDescription();
        // 阴保调查信息_自然电位
        this.freeCorrPotential = domain.getFreeCorrPotential();
        // 阴保调查信息_通电电位
        this.tubeGroundPotential = domain.getTubeGroundPotential();
        // 阴保调查信息_极化电位
        this.polarizedPotential = domain.getPolarizedPotential();
        // 阴保调查信息_交流电压
        this.acPotential = domain.getAcPotential();
        // 外观描述
        this.appearance = domain.getAppearance();
        // 涂层厚度（mm）_0:00
        this.test1 = domain.getTest1();
        // 涂层厚度（mm）_3:00
        this.test2 = domain.getTest2();
        // 涂层厚度（mm）_6:00
        this.test3 = domain.getTest3();
        // 涂层厚度（mm）_9:00
        this.test4 = domain.getTest4();
        // 剥离强度（N/cm)_1#
        this.peelTest1 = domain.getPeelTest1();
        // 剥离强度（N/cm)_2#
        this.peelTest2 = domain.getPeelTest2();
        // 剥离强度（N/cm)_3#
        this.peelTest3 = domain.getPeelTest3();
        // 剥离强度（N/cm)_4#
        this.peelTest4 = domain.getPeelTest4();
        // 电火花检漏_检漏电压（KV）
        this.testVoltage = domain.getTestVoltage();
        // 电火花检漏_漏点数
        this.amount = domain.getAmount();
        // 土壤剖面描述_土壤颜色
        this.soilColor = domain.getSoilColor();
        // 土壤剖面描述_土壤干湿度（DRY、MOIST、DAMP、WET、WATER）
        this.soilHumidity = SoilHumidityEnum.getLabel(domain.getSoilHumidity());
        // 土壤剖面描述_土壤松紧度(LOOSE、PINE、A_LITTLE_TIGHT、TIGHT、VERY_TIGHT)
        this.soilCompactness = SoilCompactnessEnum.getLabel(domain.getSoilCompactness());
        // 土壤剖面描述_根系植物（LUSH、SECONDARY、NOTHING、VERY_SELDOM ）
        this.deeprootedPlants = DeeprootedPlantsEnum.getLabel(domain.getDeeprootedPlants());
        // 土壤理化性能_pH值
        this.soilPh = domain.getSoilPh();
        // 土壤理化性能_氧化还原电位（mV）
        this.redoxPotential = domain.getRedoxPotential();
        // 土壤理化性能_含水率（%）
        this.moistureContent = domain.getMoistureContent();
        // 土壤理化性能_含盐量（%）
        this.saltContent = domain.getSaltContent();
        // 土壤理化性能_氯离子（%）
        this.chlorideion = domain.getChlorideion();
        // 土壤理化性能_硫酸根离子（%）
        this.sulfateion = domain.getSulfateion();
        // 管/地电位（mV）
        this.pipeToSoilPotential = domain.getPipeToSoilPotential();
        // 附着力/撬剥法（级）
        this.adhesion = domain.getAdhesion();
        // 粘结强度/拉开法（MPa）
        this.bondstrength = domain.getBondstrength();
        // 剥离强度（N/cm）_对钢
        this.forsteel = domain.getForsteel();
        // 剥离强度（N/cm）_对管体防腐层
        this.pipeAnticorrLayer = domain.getPipeAnticorrLayer();
        // 管体壁厚（mm）
        this.wallThickness = domain.getWallThickness();
        // 最大腐蚀坑深度（mm）
        this.maxCorrDepth = domain.getMaxCorrDepth();
        // 最小剩余壁厚（mm）
        this.minResidualWallThick = domain.getMinResidualWallThick();
        // 腐蚀缺陷最大轴向长度（mm）
        this.maxAxialCorrDefects = domain.getMaxAxialCorrDefects();
        // 腐蚀缺陷最大周向长度（mm）
        this.maxCircCorrDefects = domain.getMaxCircCorrDefects();
        // 管体修复建议
        this.pipeBodyRepair = domain.getPipeBodyRepair();
        // 检测日期
        this.testingDate = DateFormat.format(domain.getTestingDate());
        // 检测单位
        this.testingCompany = domain.getTestingCompany();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordTime(), domain.getRemarks());
    }

    public Page<ExinspOclpointDigVO> fromDomainList(Page<ExinspOclpointDig> domainList) {

        Page<ExinspOclpointDigVO> list = new Page<ExinspOclpointDigVO>();
        for (ExinspOclpointDig exinspOclpointDig : domainList) {
            ExinspOclpointDigVO exinspOclpointDigVO = new ExinspOclpointDigVO();
            exinspOclpointDigVO.fromDomain(exinspOclpointDig);
            list.add(exinspOclpointDigVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}